package com.wx.mall.goods.feign;



import com.alibaba.fastjson.JSON;
import com.wx.mall.common.vo.goods.SpuVo;
import com.wx.mall.goods.entity.Spu;
import com.wx.mall.goods.service.ISpuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/spufeign")
@Api(tags = "spu表feign调用")
@Slf4j
public class SpuFeignController {

    @Resource
    private ISpuService service;
    @ApiOperation("查询所有数据")
    @GetMapping("/getList")
    public List<SpuVo> getList(){

        List<Spu> list=service.list();
        List<SpuVo> spuVoList= JSON.parseArray( JSON.toJSONString(list) , SpuVo.class);


        return spuVoList;
    }
}
